<?php

//GLOBAL $PWerr;

if (isset($_POST['act']))
{
	/*if ($_POST['act'] == "status")
	{
		$get_result = edit_status($_POST['dispo']);
		if ($get_result == 0)
		{
			$msg = "Les modifications ont bien &eacute;t&eacute; enregistr&eacute;es!";
			$PWerr->setSize('s');
			$PWerr->sNotice($msg);
		}	
		else
		{
			$msg = "Erreur lors de la modification!";
			$PWerr->setSize('s');
			$PWerr->sWarning($msg);
		}
	}
	elseif ($_POST['act'] == "titles")
	{
		$get_result = edit_titles($_POST['title'], $_POST['subtitle']);
		if ($get_result == 0)
		{
			$msg = "Les modifications ont bien &eacute;t&eacute; enregistr&eacute;es!";
			$PWerr->setSize('s');
			$PWerr->sNotice($msg);
			redirect('index.php', 1500);
		}	
		else
		{
			$msg = "Erreur lors de la modification!";
			$PWerr->setSize('s');
			$PWerr->sWarning($msg);
		}
	}*/
	
	if ($_POST['act'] == "status")
	{
		$get_result = edit_status($_POST['dispo']);
		if ($get_result == 0)
		{
			Print("
			<div id=\"valid\" style=\"visibility: visible;\">
				Les modifications ont bien &eacute;t&eacute; enregistr&eacute;es!
			</div>
			");
		}	
		else
		{
			Print("
			<div id=\"error\" style=\"visibility: visible;\">
				Erreur lors de la modification!
			</div>
			");
		}
	}
	elseif ($_POST['act'] == "titles")
	{
		$get_result = edit_titles($_POST['title'], $_POST['subtitle']);
		if ($get_result == 0)
		{
			Print("
			<div id=\"valid\" style=\"visibility: visible;\">
				Les modifications ont bien &eacute;t&eacute; enregistr&eacute;es!
			</div>
			");
			Print("<SCRIPT LANGUAGE=\"JavaScript\">window.setTimeout(\"location=('index.php');\",1500)</script>");
		}	
		else
		{
			Print("
			<div id=\"error\" style=\"visibility: visible;\">
				Erreur lors de la modification!
			</div>
			");
		}
	}
}

Print("
	<table width=100% border=0>
		<tr>
			<td valign=top width=50%>
	<div id=\"box\" style=\"height:111px;\">
		<h3>Disponibilit&eacute; du site</h3>
");

if ($_SESSION['status'] == "online")
	{
		Print("
			<form action=\"index.php\" method=POST>
			<input type=hidden name=\"act\" value=\"status\">
			<table width=100%>
				<tr>
					<td width=70>En ligne :</td>
					<td width=20><input type=radio name=\"dispo\" value=\"online\" checked></td>
					<td width=20><img src=\"$_SESSION[current_path]/images/net_1.png\"></td>
				</tr>
				<tr>
					<td>Hors ligne :</td>
					<td><input type=radio name=\"dispo\" value=\"offline\"></td>
					<td><img src=\"$_SESSION[current_path]/images/net_2.png\"></td>
					<td><input type=submit value=\"Modifier\" onClick=\"this.form.submit();this.disabled=true;this.value='Modification en cours...'\"></td>
				</tr>
			</table>
			</form>
		");
	}
	else
	{
		Print("
			<form action=\"index.php\" method=POST>
			<input type=hidden name=\"act\" value=\"status\">
			<table width=100%>
				<tr>
					<td width=70>En ligne :</td>
					<td width=20><input type=radio name=\"dispo\" value=\"online\"></td>
					<td width=20><img src=\"$_SESSION[current_path]/images/net_1.png\"></td>
				</tr>
				<tr>
					<td>Hors ligne :</td>
					<td><input type=radio name=\"dispo\" value=\"offline\" checked></td>
					<td><img src=\"$_SESSION[current_path]/images/net_2.png\"></td>
					<td><input type=submit value=\"Modifier\" onClick=\"this.form.submit();this.disabled=true;this.value='Modification en cours...'\"></td>
				</tr>
			</table>
			</form>
		");
	}

	Print("
		</div>
	</td>
	<td valign=top width=50%>
		<div id=\"box\">
		<h3>Edition des titres</h3>
			<form action=\"index.php\" method=POST>
			<input type=hidden name=\"act\" value=\"titles\">
			<table width=100%>
				<tr>
					<td width=70>Titre :</td>
					<td width=25><input type=text name=\"title\" value=\"$_SESSION[title]\"></td>
				</tr>
				<tr>
					<td>Slogan :</td>
					<td><input type=text name=\"subtitle\" value=\"$_SESSION[subtitle]\"></td>
					<td><input type=submit value=\"Modifier\" onClick=\"this.form.submit();this.disabled=true;this.value='Modification en cours...'\"></td>
				</tr>
			</table>
			</form>
		</div>
	</td>
</tr>
</table>
		
		<div id=\"box\">
		<h3>Version d'EnsKa PHP</h3>
			<table>
				<tr>
					<td>Version ODT - EnsKa PHP :</td>
					<td><b><font color=royalblue>$_SESSION[ver_wup]</font></b></td>
				</tr>
				<tr>
					<td>Version du panneau d'administration :</td>
					<td><b><font color=royalblue>$wa</font></b></td>
				</tr>
				<tr>
					<td>Last release :</td>
					<td><b><font color=royalblue>$_SESSION[release_wup]</font></b></td>
				</tr>
			</table>
			
			<br><br>
			
			<table>
				<tr>
					<td width=65><img src=\"$_SESSION[current_path]/images/maj_1.png\"></td>");
					$maj = is_maj($_SESSION['ver_wup']);
					if ($maj != 0 && $maj != -1)
					{
						Print("
							<td>
								Nouvelle version disponible : $maj<br>
								<a href=\"http://www.opendevtools.net/download.php?action=fra\" target=\"_blank\"><b>Mettre &agrave; jour</b></a>
							</td>
						");
					}
					elseif ($maj == -1)
					{
						Print("
							<td>
								<b><font color=red>Impossible de contacter le serveur de mises &agrave; jour!<br>
								V&eacute;rifiez votre connexion internet!</font></b>
							</td>
						");
					}
					else
					{
						Print("
							<td>
								<b><font color=royalblue>Votre version est &agrave; jour</font></b>
							</td>
						");
					}
				Print("</tr>
			</table>
		</div>
	");



?>